package com.jumper.study.admin.service;

import java.util.Collection;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jumper.study.admin.dto.req.LessonSearchReq;
import com.jumper.study.db.dto.LessonDto;
import com.jumper.study.db.model.Lesson;

public interface LessonService extends BaseService<Lesson> {
    //根据课程名称查找课程
    Lesson getByTitle(String title, Long id);

    //更新推荐
    boolean recommendById(Long id, boolean recommend);

    //批量更新推荐设置
    boolean recommendBatchById(Collection<Long> ids, boolean recommend);

    //上架设置
    boolean onselfById(Long id, boolean onself);

    //批量设置上架
    boolean onselfBatchById(Collection<Long> ids, boolean onself);

    //查询分类下是否有课程
    boolean hasLessons(Integer categoryId);

    //分页读取课程列表
    IPage<LessonDto> listWithCategory(IPage<LessonDto> page, LessonSearchReq req);

    Long lessonCount(Boolean onself);

    default Long lessonCount() {
        return lessonCount(null);
    }
}
